package com.ccc.scala.base4_flow

object Flow2_for {
  def main(args: Array[String]): Unit = {
    // 循环控制 while do...while  for

    // for
    for (i: Int <- 1 to 5) { // 1 <= i <= 5
      print(i + " ")
    }
    println()

    for (i: Int <- 1 until 5) { // 1 <= i < 5
      print(i + " ")
    }

    println()

    for (i <- Range(1, 5)) { // 1 <= i < 5
      print(i + " ")
    }
    println()
    // 循环步长
    for (i <- 1 to 5 by 2) {
      print(i + " ")
    }


  }
}
